begin
    insert
    into region
    (id, name, parentId)
    values
    (REGION_SEQ.nextval, ?, ?)
    returning
    REGION_SEQ.currval into ?;
end;
-- sequence not allowed here



declare
    idn int := REGION_SEQ.nextval;
begin
    insert
    into region
    (id, name, parentId)
    values
    (idn, ?, ?)
    returning 
    idn into ?;
end;
--
-- Caused by: java.lang.NullPointerException
-- 	at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java:300)
-- 	at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.java:270)
-- 	at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCDataSet(TTCAdapter.java:231)
-- 	at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1927)
-- 	at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
-- 	at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)
-- 	at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)
-- 	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)
-- 	at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
-- 	at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:736)
-- 	at com.sun.gjc.spi.base.PreparedStatementWrapper.execute(PreparedStatementWrapper.java:508)
-- 	at is.bean.region.RegionBean.ejbCreateInstance(RegionBean.java:86)